/**
 *  *2010-5-19 上午10:37:21  add 
 */
package com.base.myproject.client.HR.setting;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import com.base.myproject.client.HR.Salary.SelectGrid;
import com.base.myproject.client.HR.bcode.HrBcodeSelectButton;
import com.base.myproject.client.busi.BaseStore;
import com.base.myproject.client.busi.BO.BusiObject;
import com.base.myproject.client.busi.BO.TreeNodeModelData;
import com.base.myproject.client.jdbc.DataSet;
import com.base.myproject.client.jdbc.StoreInfo;
import com.base.myproject.client.system.Env;
import com.base.myproject.client.system.SystemMessage;
import com.base.myproject.client.ui.BaseBusiLeftPanel;
import com.base.myproject.client.ui.BaseFormPanel;
import com.base.myproject.client.ui.BaseGridPanel;
import com.base.myproject.client.ui.BaseJDBCPanel;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.NumberField;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.layout.TableData;
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel.CheckNodes;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

/**
 * 社保策略
 * @author Administrator 2010-5-19 javazgw@gmail.com
 */
public class Social_S extends BaseJDBCPanel {

	BaseStore<BusiObject> store = null;
	ColumnConfig systembcodecolumn ;
	ColumnConfig systembcodecolumn_lw;
	HrBcodeSelectButton hrbsb ;
	HrBcodeSelectButton hrbsb_lw ;
	NumberFormat nf = NumberFormat.getFormat("#,##.##%");
	public Social_S() {
		super();
		init();
	}
	public void init() {		
		initrenderer();	
		this.add(initWeigetx());
		registerMainStore(store);
		registerStore(store);
		registerStore(hr_Social_Sdetail_store);	
		
	}

	private void setdefault() {
		store.addDefault("bcode", Env.getEnvbcode());
	}

	public void complete() {
		super.complete();
	}

	private Widget initWeigetx() {
		VerticalPanel v = new VerticalPanel();
		HorizontalPanel h= new HorizontalPanel();
		v.setHorizontalAlign(HorizontalAlignment.LEFT);
		v.setSpacing(1);
		h.setVerticalAlign(VerticalAlignment.TOP);
		h.add(CreateCcodeLeftPanel());
		v.add(createForm());
		v.add(create_hr_Social_Sdetail_Grid());
		
		
		
		//----
		
		

		
		
		initSelectGrid();
		TabPanel panel = new TabPanel();
		panel.setPlain(true);
		panel.setSize(727, 155);
		
		TabItem zz_tab = new TabItem("组织");
		zz_tab.add(createBcodeGrid());
		hrbsb = new HrBcodeSelectButton()
		{
		public void doposted(List<TreeNodeModelData> modeldatalist) {
			for(TreeNodeModelData tnmd : modeldatalist)
			{
				HashMap hm = new HashMap();
				hm.put("systembcode", tnmd.get("systembcode"));
				hm.put("sheetcode", "Social_S");//这里是针对每个类用到组织条件的时候 添加进去类名  用于区分
				this.getTarget_store().add(hm);
			}
		}
		};
		hrbsb.setCheckNodes(CheckNodes.BOTH);
		hrbsb.setNeesreselect(true);
		hrbsb.setTarget_store(bcode_store);
		zz_tab.setAutoHeight(true);
		panel.add(zz_tab);

		TabItem zy_tab = new TabItem("职级");
		zy_tab.addStyleName("pad-text");
		zy_tab.add(zy_Grid);
		panel.add(zy_tab);

		TabItem ji_neng = new TabItem("雇佣组别");// hr_jobgroup
		ji_neng.addStyleName("pad-text");
		ji_neng.add(jobgroup_Grid);
		panel.add(ji_neng);

		TabItem z_j = new TabItem("雇佣性质"); // hr_jobproperty
		z_j.addStyleName("pad-text");
		z_j.add(jobproperty_Grid);
		panel.add(z_j);

		TabItem lb_tab = new TabItem("雇佣类别"); // hr_jobtype
		lb_tab.addStyleName("pad-text");
		lb_tab.add(jobtype_Grid);
		panel.add(lb_tab);

		TabItem zyzk_tab = new TabItem("雇佣状况"); // hr_jobtype
		zyzk_tab.addStyleName("pad-text");
		zyzk_tab.add(zyzk_Grid);
		panel.add(zyzk_tab);
		
		TabItem zyzk_hjq = new TabItem("户籍区"); // hr_jobtype
		zyzk_hjq.addStyleName("pad-text");
		zyzk_hjq.add(hjq_Grid);
		panel.add(zyzk_hjq);
		
		TabItem zyzk_cx = new TabItem("城/乡"); // hr_jobtype
		zyzk_cx.addStyleName("pad-text");
		zyzk_cx.add(cx_Grid);
		panel.add(zyzk_cx);
		
		//例外
		TabItem lw_tab = new TabItem("例外");
		lw_tab.add(createlwGrid());
		hrbsb_lw = new HrBcodeSelectButton()
		{
		public void doposted(List<TreeNodeModelData> modeldatalist) {
			for(TreeNodeModelData tnmd : modeldatalist)
			{
				HashMap hm = new HashMap();
				hm.put("systembcode", tnmd.get("systembcode"));
				hm.put("sheetcode", "Social_S");
				this.getTarget_store().add(hm);
			}
		}
		};
		hrbsb_lw.setCheckNodes(CheckNodes.BOTH);
		hrbsb_lw.setNeesreselect(true);
		hrbsb_lw.setTarget_store(lw_store);
		lw_tab.setAutoHeight(true);
		panel.add(lw_tab);
		
		//----
		v.add(panel);
		h.add(v);
		h.setSpacing(5);

		return h;
	}

	public ContentPanel CreateCcodeLeftPanel() {
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		ColumnConfig code = new ColumnConfig("code", "编号", 50);
		ColumnConfig name = new ColumnConfig("name", "名称", 150);
		
		TextField<String> gnametext = new TextField<String>();

		columns.add(code);
		columns.add(name);
		ColumnModel cm = new ColumnModel(columns);
		// --set modetype
		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("code");
		type.getField("code").setType(String.class);
		type.addField("name");
		type.getField("name").setType(String.class);
		type.addField("enname");
		type.getField("enname").setType(String.class);
		type.addField("Social_S_type");
		type.getField("Social_S_type").setType(String.class);
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_Social_S");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_Social_S");

		BaseBusiLeftPanel<BusiObject> basbusileftpanel = new BaseBusiLeftPanel<BusiObject>(
				columns, type, info);
		store = basbusileftpanel.getStore();
		basbusileftpanel.getGrid().setWidth("260");
		basbusileftpanel.getGrid().setHeight(449);
		setMaincomponent(basbusileftpanel.getGrid());
		return basbusileftpanel.getPanel();
	}
	/****************************************/

	SelectGrid zy_Grid;
	SelectGrid jobgroup_Grid;
	SelectGrid jobproperty_Grid;
	SelectGrid jobtype_Grid;
	SelectGrid zyzk_Grid;
	SelectGrid hjq_Grid;
	SelectGrid  cx_Grid;
	public void initSelectGrid() {
		// 创建多个Grid应用的table页中
		//职级
		zy_Grid = new SelectGrid(
				store,
				"hr_range_zy_c",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'zy' ) as a left join  (select code,isset,upcode from hr_range_zy_c where  sheetcode='Social_S' and upcode = '{icode}' ) as b on a.code = b.code",
				"icode","Social_S");	
		// 雇佣组别
		jobgroup_Grid = new SelectGrid(
				store,
				"hr_range_jobgroup",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_jobgroup' ) as a left join  (select code,isset,upcode from hr_range_jobgroup where sheetcode='Social_S' and upcode = '{icode}' ) as b on a.code = b.code",
				"icode","Social_S");
		// 雇佣性质
		jobproperty_Grid = new SelectGrid(
				store,
				"hr_range_jobproperty",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_jobproperty' ) as a left join  (select code,isset,upcode from hr_range_jobproperty where sheetcode='Social_S' and upcode = '{icode}' ) as b on a.code = b.code",
				"icode","Social_S");
		// 雇佣类别
		jobtype_Grid = new SelectGrid(
				store,
				"hr_range_jobtype",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_jobtype' ) as a left join  (select code,isset,upcode from hr_range_jobtype where sheetcode='Social_S' and upcode = '{icode}' ) as b on a.code = b.code",
				"icode","Social_S");
		// 雇佣状况
		zyzk_Grid = new SelectGrid(
				store,
				"hr_range_zyzk",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'zyzk' ) as a left join  (select code,isset,upcode from hr_range_zyzk where sheetcode='Social_S' and upcode = '{icode}' ) as b on a.code = b.code",
				"icode","Social_S");
		
		//户籍区
		hjq_Grid = new SelectGrid(
				store,
				"hr_range_hjq",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_a' ) as a left join  (select code,isset,upcode from hr_range_hjq where sheetcode='Social_S' and upcode = '{icode}' ) as b on a.code = b.code",
				"icode","Social_S");
		//城乡
		cx_Grid = new SelectGrid(
				store,
				"hr_range_cx",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_cz' ) as a left join  (select code,isset,upcode from hr_range_cx where sheetcode='Social_S' and upcode = '{icode}' ) as b on a.code = b.code",
				"icode","Social_S");
		
		
		
		zy_Grid.grid.setHeight(125);
		jobgroup_Grid.grid.setHeight(125);
		jobproperty_Grid.grid.setHeight(125);
		jobtype_Grid.grid.setHeight(125);
		zyzk_Grid.grid.setHeight(125);
		hjq_Grid.grid.setHeight(125);
		cx_Grid.grid.setHeight(125);
		
		zy_Grid.setBorders(false);
		jobgroup_Grid.setBorders(false);
		jobproperty_Grid.setBorders(false);
		jobtype_Grid.setBorders(false);
		zyzk_Grid.setBorders(false);
		hjq_Grid.setBorders(false);
		cx_Grid.setBorders(false);

	}

	BaseStore<BusiObject> bcode_store = null;
	BaseStore<BusiObject> getBcodeStore() {
		if (bcode_store == null) {
			createBcodeStore();
		}
		return bcode_store;
	}
	BaseStore<BusiObject> createBcodeStore() {
		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("systembcode");
		type.getField("systembcode").setType(String.class);
		type.addField("upcode");
		type.getField("upcode").setType(String.class);
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_range_bcode");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_range_bcode where sheetcode='Social_S' and upcode ='{icode}'");
		 info.setParent(store);// 关联主表
		 info.setLinkparentcolumns(new String[] { "icode" }); // 关联主表字段
		 info.setLinkparent_chile_columns(new String[] { "upcode" });//
		// 关联主表字段
		bcode_store = new BaseStore<BusiObject>(type, info);
		return bcode_store;
	}
	BaseGridPanel bcodegrid = null;
	BaseGridPanel createBcodeGrid() {
		CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		columns.add(cbs.getColumn());
		systembcodecolumn = new ColumnConfig("systembcode", "部门人员", 80);
		columns.add(systembcodecolumn);
		ColumnModel cm = new ColumnModel(columns);
		bcodegrid = new BaseGridPanel(getBcodeStore(), cm, true, true)
		{
			protected void addnewrecord() {
				addrecord();
			}
		};
		cbs.setSelectionMode(SelectionMode.SINGLE);
		bcodegrid.getBg().setSelectionModel(cbs);
		bcodegrid.getBg().setHeight(103);
		bcodegrid.getBg().setBorders(false);
		return bcodegrid;
	}	
	void addrecord() {
		hrbsb.showEditor();
	}	
	/*********例外************/
	BaseStore<BusiObject> lw_store = null;
	BaseStore<BusiObject> getlwStore() {
		if (lw_store == null) {
			createlwStore();
		}
		return lw_store;
	}
	BaseStore<BusiObject> createlwStore() {
		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("systembcode");
		type.getField("systembcode").setType(String.class);
		type.addField("upcode");
		type.getField("upcode").setType(String.class);
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_range_lw");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_range_lw where sheetcode='Social_S' and upcode ='{icode}'");
		 info.setParent(store);// 关联主表
		 info.setLinkparentcolumns(new String[] { "icode" }); // 关联主表字段
		 info.setLinkparent_chile_columns(new String[] { "upcode" });//
		// 关联主表字段
		 lw_store = new BaseStore<BusiObject>(type, info);
		return lw_store;
	}
	BaseGridPanel lwgrid = null;
	BaseGridPanel createlwGrid() {
		CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		columns.add(cbs.getColumn());
		systembcodecolumn_lw = new ColumnConfig("systembcode", "部门人员", 80);
		columns.add(systembcodecolumn_lw);
		ColumnModel cm = new ColumnModel(columns);
		lwgrid = new BaseGridPanel(getlwStore(), cm, true, true)
		{
			protected void addnewrecord() {
				addlwrecord();
			}
		};
		cbs.setSelectionMode(SelectionMode.SINGLE);
		lwgrid.getBg().setSelectionModel(cbs);
		lwgrid.getBg().setHeight(103);
		lwgrid.getBg().setBorders(false);
		return lwgrid;
	}	
	void addlwrecord() {
		hrbsb_lw.showEditor();
	}	
	
	
	
	
	
	/********************/
	
	
	void initrenderer()
	{
		final com.base.myproject.client.tools.GreetingServiceAsync greetingService = GWT
		.create(com.base.myproject.client.tools.GreetingService.class);
greetingService.getDataSet(
		"select systembcode,bname from systembcode_view ",
		new AsyncCallback<DataSet>() {

			@Override
			public void onFailure(Throwable caught) {
				Info.display("", "失败");
			}

			@Override
			public void onSuccess(final DataSet result) {
				Info.display("", "成功");
				 GridCellRenderer gcr = new GridCellRenderer()
				{

					@Override
					public Object render(ModelData model, String property,
							ColumnData config, int rowIndex, int colIndex,
							ListStore store, Grid grid) {
						// TODO Auto-generated method stub
						for(int i=0;i<result.getRowCount();i++)
						{
							
							
							if(result.getValue(i, "systembcode").equals(model.get(property)))
							{
							return	result.getValue(i, "bname");
							}
						}
						return model.get(property);
					
					}
					
				};
				systembcodecolumn.setRenderer(gcr);
				bcodegrid.getBg().getView().refresh(false);
				systembcodecolumn_lw.setRenderer(gcr);
				lwgrid.getBg().getView().refresh(false);
				
			}

		});
	
		//return null;
		
	}


	BaseFormPanel createForm() {
		BaseFormPanel form = new BaseFormPanel(store);
		TableLayout tl = new TableLayout(4);

		TableData td = new TableData();
		td.setRowspan(1);
		td.setHorizontalAlign(HorizontalAlignment.LEFT);
		td.setVerticalAlign(VerticalAlignment.TOP);
		td.setPadding(2);
		form.setLayout(tl);
		form.setHeaderVisible(false);

		form.add(new Label("编号:"), td);
		TextField<String> C_num2 = new TextField<String>();
		C_num2.setName("code");
		form.add(C_num2, td);
		form.add(new Label("名称:"), td);
		TextField<String> C_num3 = new TextField<String>();
		C_num3.setName("name");
		form.add(C_num3, td);
		form.add(new Label("英文名称:"), td);
		TextField<String> C_num4 = new TextField<String>();
		C_num4.setName("enname");
		form.add(C_num4, td);
		form.add(new Label("类型:"), td);
		TextField<String> C_num5 = new TextField<String>();
		C_num5.setName("Social_S_type");
		form.add(C_num5, td);
		form.inited();
		return form;
	};

	BaseStore<BusiObject> hr_Social_Sdetail_store = null;
	BaseStore<BusiObject> get_hr_Social_Sdetail_Store() {
		if (hr_Social_Sdetail_store == null) {
			create_hr_Social_Sdetail_Store();
		}
		return hr_Social_Sdetail_store;
	}
	BaseStore<BusiObject> create_hr_Social_Sdetail_Store() {
		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("upicode");
		type.getField("upicode").setType(String.class);
		type.addField("Salarybegin");
		type.getField("Salarybegin").setType(Double.class);
		type.addField("Salaryend");
		type.getField("Salaryend").setType(Double.class);
		type.addField("Intervalstart");
		type.getField("Intervalstart").setType(String.class);
		type.addField("Intervalend");
		type.getField("Intervalend").setType(String.class);
		type.addField("Effectdate");
		type.getField("Effectdate").setType(Date.class);
		type.addField("Employer_Percentage");
		type.getField("Employer_Percentage").setType(Double.class);
		type.addField("Employee_Percentage");
		type.getField("Employee_Percentage").setType(Double.class);
		type.addField("Employer_Amount");
		type.getField("Employer_Amount").setType(Double.class);
		type.addField("Employee_Amount");
		type.getField("Employee_Amount").setType(Double.class);
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_Social_Sdetail");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_Social_Sdetail where upicode='{icode}'");
		 info.setParent(store);// 关联主表
		 info.setLinkparentcolumns(new String[] { "icode" }); // 关联主表字段
		 info.setLinkparent_chile_columns(new String[] { "upicode" });//
		// 关联主表字段
		hr_Social_Sdetail_store = new BaseStore<BusiObject>(type, info);
		return hr_Social_Sdetail_store;
	}

	BaseGridPanel hr_Social_Sdetail_grid = null;

	BaseGridPanel create_hr_Social_Sdetail_Grid() {
		CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		columns.add(cbs.getColumn());

//		ColumnConfig C1 = new ColumnConfig("icode", "icode", 80);
//		columns.add(C1);
//		ColumnConfig C2 = new ColumnConfig("upicode", "upicode", 80);
//		columns.add(C2);
		ColumnConfig C3 = new ColumnConfig("Salarybegin", "起薪点", 80);
		C3.setNumberFormat(NumberFormat.getCurrencyFormat());  
		C3.setEditor(new CellEditor(new NumberField()));  
		columns.add(C3);
		ColumnConfig C4 = new ColumnConfig("Salaryend", "到", 80);
		C4.setNumberFormat(NumberFormat.getCurrencyFormat());  
		C4.setEditor(new CellEditor(new NumberField()));  
		columns.add(C4);
//		ColumnConfig C5 = new ColumnConfig("Intervalstart", "Intervalstart", 80);
//		columns.add(C5);
//		ColumnConfig C6 = new ColumnConfig("Intervalend", "Intervalend", 80);
//		columns.add(C6);
		ColumnConfig C7 = new ColumnConfig("Effectdate", "生效日期", 120);
		 DateField dateField7 = new DateField();  
		    dateField7.getPropertyEditor().setFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));  
		    C7.setEditor(new CellEditor(dateField7));
		    C7.setDateTimeFormat(DateTimeFormat.getFormat("yyyy-MM-dd"));
		columns.add(C7);
		ColumnConfig C8 = new ColumnConfig("Employer_Percentage",
				"雇主百分比", 80);
		
		C8.setEditor(new CellEditor(new NumberField()));  
		C8.setNumberFormat(nf);
		columns.add(C8);
		
		ColumnConfig C9 = new ColumnConfig(
				"Employee_Percentage","雇员百分比", 80);
		C9.setEditor(new CellEditor(new NumberField()));  
		C9.setNumberFormat(nf);
		columns.add(C9);
		ColumnConfig C10 = new ColumnConfig(
				"Employer_Amount","雇主金额", 80);
		C10.setNumberFormat(NumberFormat.getCurrencyFormat());  
		C10.setEditor(new CellEditor(new NumberField()));  
		columns.add(C10);
		ColumnConfig C11 = new ColumnConfig(
				"Employee_Amount", "雇员金额",80);
		C11.setNumberFormat(NumberFormat.getCurrencyFormat());  
		C11.setEditor(new CellEditor(new NumberField()));  
		columns.add(C11);

		ColumnModel cm = new ColumnModel(columns);
		hr_Social_Sdetail_grid = new BaseGridPanel(
				get_hr_Social_Sdetail_Store(), cm, true, true);
		cbs.setSelectionMode(SelectionMode.SINGLE);
		hr_Social_Sdetail_grid.getBg().setSelectionModel(cbs);
		hr_Social_Sdetail_grid.getBg().setHeight(232);
		return hr_Social_Sdetail_grid;
	}

	int sync = 0;
	Listener<BaseEvent> defaultlistener;

	Listener<BaseEvent> getListener() {
		if (defaultlistener != null) {
			return defaultlistener;
		}

		defaultlistener = new Listener<BaseEvent>() {
			public void handleEvent(BaseEvent be) {
				sync++;
				try {
					if (sync == 1) {
						if (be.getType() == Events.Select) {
							if (be.getSource().equals("按钮变量")) {

							}
						} else if (be.getType() == Events.Change) {
							if (be.getSource().equals("输入型变量")) {

							}
						} else if (be.getType() == Events.KeyUp) {
							if (be instanceof ComponentEvent) {
								if (((ComponentEvent) be).getKeyCode() == 13) // 回车
								{
								}
							}
						}
					}
				} finally {
					sync--;
				}
			}

		};
		return defaultlistener;
	}
}
